/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ps.server.classes;

import java.util.ArrayList;

/**
 *
 * @author Ricardo
 */
public class manufacturers {

    private String id;
    private String active;
    private String name;
    private String[][] short_description;
    private String[][] meta_title;
    private String[][] meta_description;
    private String[][] description;
    private String[][] meta_keywords;
    private ArrayList associations;
    private String[] addresses;
    private int column = 9;

    public String getActive() {
        return active;
    }

    public void setActive(String active) {
        this.active = active;
    }

    public String[] getAddresses() {
        return addresses;
    }

    public void setAddresses(String[] addresses) {
        this.addresses = addresses;
    }

    public String[][] getDescription() {
        return description;
    }

    public void setDescription(String[][] description) {
        this.description = description;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String[][] getMeta_description() {
        return meta_description;
    }

    public void setMeta_description(String[][] meta_description) {
        this.meta_description = meta_description;
    }

    public String[][] getMeta_keywords() {
        return meta_keywords;
    }

    public void setMeta_keywords(String[][] meta_keywords) {
        this.meta_keywords = meta_keywords;
    }

    public String[][] getMeta_title() {
        return meta_title;
    }

    public void setMeta_title(String[][] meta_title) {
        this.meta_title = meta_title;
    }

    public String getName() {

        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String[][] getShort_description() {
        return short_description;
    }

    public void setShort_description(String[][] short_description) {
        this.short_description = short_description;
    }

    public String toXML() {
        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                + "<prestashop xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
        xml += "<manufacturer>\n";
        xml += "<id>" + this.getId() + "</id>\n";
        xml += "<active>" + this.getActive() + "</active>\n";
        xml += "<name>" + this.getName() + "</name>\n";
        xml += "<short_description>\n";
        for (int x = 0; short_description.length > x; x++) {
            xml += "<language id=\"" + short_description[x][0] + " \">" + short_description[x][1] + "</language>\n";
        }
        //xml += "<language id=\"3\">"+   +"</language>\n";
        //xml += "<language id=\"5\">"+    +"</language>\n";
        xml += "</short_description>\n";
        xml += "<meta_title>\n";
        for (int x = 0; meta_title.length > x; x++) {
            xml += "<language id=\"" + meta_title[x][0] + " \">" + meta_title[x][1] + "</language>\n";
        }
        //xml += "<language id=\"3\">"+   +"</language>\n";
        //xml += "<language id=\"5\">"+    +"</language>\n";
        xml += "</meta_title>\n";
        xml += "<meta_description>\n";
        for (int x = 0; meta_description.length > x; x++) {
            xml += "<language id=\"" + meta_description[x][0] + " \">" + meta_description[x][1] + "</language>\n";
        }
        //xml += "<language id=\"3\">"+    +"</language>\n";
        //xml += "<language id=\"5\">"+    +"</language>\n";
        xml += "</meta_description>\n";
        xml += "<description>\n";
        for (int x = 0; description.length > x; x++) {
            xml += "<language id=\"" + description[x][0] + " \">" + description[x][1] + "</language>\n";
        }
        //xml += "<language id=\"3\">"+    +"</language>\n";
        //xml += "<language id=\"5\"> </language>\n";
        xml += "</description>\n";
        xml += "<meta_keywords>\n";
        for (int x = 0; meta_keywords.length > x; x++) {
            xml += "<language id=\"" + meta_keywords[x][0] + " \">" + meta_keywords[x][1] + "</language>\n";
        }
        //xml += "<language id=\"3\">"+    +"</language>\n";
        //xml += "<language id=\"5\">"+    +"</language>\n";
        xml += "</meta_keywords>\n";
        xml += "<associations>\n";
        xml += "<addresses>\n";
        for (int x = 0; addresses.length > x; x++) {
            xml += "<address>\n";
            xml += "<id>" + this.addresses[x] + "</id>\n";
            xml += "</address>\n";
        }
        xml += "</addresses>\n";
        xml += "</associations>\n";
        xml += "</manufacturer>\n";
        xml += "</prestashop>";
        return xml;
    }

    public int getColumn() {
        return this.column;
    }

    public String[] GetMetaData() {
        return new String[]{"id", "active", "name", "short_description", "meta_title", "meta_description", "description","meta_keywords","address"};
    }
}